from dataclasses import dataclass,field

@dataclass
class Rectangle:
    width:float
    height:float
    area:float=field(init=False)

    def __post_init__(self):
        self.area = self.width * self.height
        
@dataclass
class Circle:
    radius:float
    area:float=field(init=False)
    def __post_init__(self):
        self.area = 3.14 * self.radius **2
        
shapes = [Rectangle(5,10),Circle(5)]

for shape in shapes:
    print("type:{} area:{}".format(shape.__class__.__name__,shape.area))